<template>
  <section class="profile-section">
    <h2>选择你的难度档案</h2>

    <div class="container">
      <div class="card" v-for="(item, index) in cards" :key="index">
        <div class="content">
          <div class="imgBx">
            <img :src="item.img" alt=""/>
          </div>

          <div class="contentBx">
            <h3>
              {{ item.name }}<br/>
              <span>{{ item.desc }}</span>
            </h3>
          </div>

          <ul class="sci">
            <li v-for="(icon, i) in item.icons" :key="i" :style="{'--i': i + 1}">
              <el-button class="action-btn" @click="lookGradeRead(item)">
                <i :class="icon.class"/>
                <span>{{ icon.desc }}</span>
              </el-button>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </section>
</template>

<script>
export default {
  name: 'ProfileCards',
  data() {
    return {
      cards: [
        {
          img: require('@/assets/readPic/primarySchool.jpg'),
          name: '小学阅读',
          desc: '更新至 320 篇',
          icons: [
            { desc: '学习', class: 'fa-solid fa-dove' },
            { desc: '投稿', class: 'fa-solid fa-envelope-open-text' }
          ]
        },
        {
          img: require('@/assets/readPic/juniorHighSchool.jpg'),
          name: '初中阅读',
          desc: '更新至 320 篇',
          icons: [
            { desc: '学习', class: 'fa-solid fa-dove' },
            { desc: '投稿', class: 'fa-solid fa-envelope-open-text' }
          ]
        },
        {
          img: require('@/assets/readPic/highSchool.jpg'),
          name: '高中阅读',
          desc: '更新至 320 篇',
          icons: [
            { desc: '学习', class: 'fa-solid fa-dove' },
            { desc: '投稿', class: 'fa-solid fa-envelope-open-text' }
          ]
        },
        {
          img: require('@/assets/readPic/gradingExamination.jpg'),
          name: '考级阅读',
          desc: '更新至 320 篇',
          icons: [
            { desc: '学习', class: 'fa-solid fa-dove' },
            { desc: '投稿', class: 'fa-solid fa-envelope-open-text' }
          ]
        }
      ]
    }
  },
  methods: {
    lookGradeRead(item) {
      this.$router.push({
        path: '/raedTrainGrade',
        query: {
          grade: item.name
        }
      })
    }
  }
}
</script>

<style scoped>
* {
  margin: 0;
  padding: 0;
  user-select: none;
}

.profile-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  background: #c1b2a3;
  min-height: 100vh;
  position: relative;
}

.action-btn {
  display: flex;
  align-items: center;
  padding: 5px 20px;
  border-radius: 8px;
  background-color: #f8f9fa;
  color: #333;
  border: none;
  transition: all 0.2s;
}

.action-btn:hover {
  background-color: #e9ecef;
  color: #0084ff;
}

.action-btn i {
  margin-right: 8px;
  font-size: 12px;
}

.action-btn span {
  font-size: 12px;
}

/*!* 右下角圆 *!
.profile-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(#30cfd0, #330867);
  clip-path: circle(30% at right 70%);
}

!* 左上角圆 *!
.profile-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(#e0c3fc, #8ec5fc);
  clip-path: circle(20% at 10% 10%);
}*/

/* container */
.container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin: 40px 0;
}

/* card */
.container .card {
  position: relative;
  width: 300px;
  height: 400px;
  margin: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
}

/* card content */
.container .card .content {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  opacity: 0.5;
  transition: 0.5s;
}

.container .card:hover .content {
  opacity: 1;
  transform: translateY(-20px);
}

.container .card .content .imgBx {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
}

.container .card .content .imgBx img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* name text */
.container .card .content .contentBx h3 {
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 500;
  font-size: 18px;
  text-align: center;
  margin: 20px 0 10px;
  line-height: 1.1em;
}

.container .card .content .contentBx h3 span {
  font-size: 12px;
  font-weight: 300;
  text-transform: initial;
}

/* bottom icons */
.container .card .sci {
  position: absolute;
  bottom: -35px;
  display: flex;
}

.container .card .sci li {
  list-style: none;
  margin: 0 10px;
  transform: translateY(40px);
  transition: 0.5s;
  opacity: 0;
  transition-delay: calc(0.1s * var(--i));
}

.container .card:hover .sci li {
  transform: translateY(0px);
  opacity: 1;
}

.container .card .sci li a {
  color: #fff;
  font-size: 24px;
}

h2 {
  color: #fff;
  text-align: center;
}
</style>
